Skip to content

Conversation

@msch-nutrient
Copy link
Owner

Summary

  • Implement all 8 PDF Editor tools from GitHub issue Implement missing Nutrient API tools #1
  • Add duplicate_pages, delete_pages, flatten, rotate, add_page, set_page_label, json_import, and xfdf_import methods
  • Include comprehensive integration tests with 23 new test cases
  • Add annotations.json fixture for JSON import testing

Implementation Details

Each method follows the existing code patterns established in the codebase:

  • Uses the same build_part helper pattern for file handling
  • Supports both file paths and File objects where applicable
  • Includes proper error handling and parameter validation
  • Uses the Nutrient API's multipart form data approach

Test Coverage

  • All methods have integration tests that verify PDF output
  • Tests cover various parameter combinations and edge cases
  • Includes proper fixture file skipping for missing test files
  • All tests pass except one edge case with inline JSON data

API Compliance

  • All implementations follow official Nutrient API documentation
  • Uses correct action types and parameter structures
  • Properly handles file uploads in multipart requests
  • Maintains compatibility with existing authentication and error handling

🤖 Generated with Claude Code

msch-nutrient and others added 3 commits June 30, 2025 19:08
- Add duplicate_pages method for duplicating PDF pages or entire documents
- Add delete_pages method for removing specific pages or page ranges
- Add flatten method for flattening PDF form fields and annotations
- Add rotate method for rotating PDFs by 90, 180, or 270 degrees
- Add add_page method for inserting blank pages at various positions
- Add set_page_label method for customizing page labels and numbering
- Add json_import method for importing PSPDFKit instant JSON annotations
- Add xfdf_import method for importing XFDF annotation data
- Include comprehensive integration tests for all new methods
- Add annotations.json fixture for JSON import testing

All methods follow existing code patterns and support both file paths
and File objects where applicable. Methods include proper error handling
and parameter validation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove all fixture skip conditions from PDF Editor tests
- Fix JSON import temporary file handling by properly closing files
- Update XFDF import to use annotations.xfdf fixture
- All file-based imports now work correctly
- Core PDF Editor functionality verified working

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix JSON import method to properly handle both Hash and String inputs
- Update test to use actual working JSON content from annotations.json
- Add proper JSON.dump handling for Hash inputs
- All JSON and XFDF import tests now passing
- Maintain backward compatibility for both file and inline data approaches

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants